-- GENERATED SPELL FOR [Skeletal Archmage] --


function spell0_31779(pUnit, Event) --@Cone of Cold,Self--
pUnit:FullCastSpellOnTarget(15244,pUnit)
pUnit:RegisterEvent('Sorts_31779', 8334, 1)
end

function spell1_31779(pUnit, Event) --@Counterspell,n/a--
pUnit:FullCastSpellOnTarget(15122,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_31779', 15329, 1)
end

function spell2_31779(pUnit, Event) --@Fireball,n/a--
pUnit:FullCastSpellOnTarget(15242,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_31779', 3000, 1)
end

function spell3_31779(pUnit, Event) --@Frost Armor,Self--
pUnit:FullCastSpellOnTarget(18100,pUnit)
pUnit:RegisterEvent('Sorts_31779', 0, 1)
end

function Sorts_31779(pUnit, Event)
local choix_sorts_31779 = math.random(0, 3)
if choix_sorts_31779 == 0 then
pUnit:RegisterEvent('spell0_31779', 1, 1)
end
if choix_sorts_31779 == 1 then
pUnit:RegisterEvent('spell1_31779', 1, 1)
end
if choix_sorts_31779 == 2 then
pUnit:RegisterEvent('spell2_31779', 1, 1)
end
if choix_sorts_31779 == 3 then
pUnit:RegisterEvent('spell3_31779', 1, 1)
end
end

function mob31779_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_31779', math.random(1500, 3000), 1)
end

function mob31779_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob31779_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob31779_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(31779, 1, 'mob31779_Action')
RegisterUnitEvent(31779, 2, 'mob31779_Leave')
RegisterUnitEvent(31779, 3, 'mob31779_Kill')
RegisterUnitEvent(31779, 4, 'mob31779_Die')
